module.exports = {
  apps: [
    {
      name: "next-sty-server",
      script: "server/index.js",
      watch: ".",
      instances: 1,
      autorestart: true,
      max_memory_restart: "1G",
      env: {
        NODE_ENV: "development",
      },
      env_production: {
        NODE_ENV: "production",
      },
    },
    {
      name: "next-sty-client",
      script: "client/index.js",
      watch: ".",
      instances: 1,
      autorestart: true,
      max_memory_restart: "1G",
      env: {
        NODE_ENV: "development",
      },
      env_production: {
        NODE_ENV: "production",
      },
    },
  ],

  deploy: {
    production: {
      user: "root",
      host: "82.157.62.28",
      ref: "origin/main",
      repo: "git@gitee.com:zzmwzy/next-sty.git",
      path: "/selfspace/next-sty", // 放在目标服务器上哪个目录下
      "pre-deploy-local": "",
      "post-deploy":
        "npm install && yarn upgrade @types/react && npm run build && pm2 reload ecosystem.config.js --env production",
      "pre-setup": "rm -rf /selfspace/next-sty/source",
    },
  },
};
